package com.kuang.demo.controller.wx;

import com.kuang.demo.bean.BaseRespVo;
import com.kuang.demo.bean.wx.TopicDetail;
import com.kuang.demo.bean.wx.TopicList;
import com.kuang.demo.bean.wx.TopicRelated;
import com.kuang.demo.service.wx.WXTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("wx/topic")
public class WXTopicController {
    @Autowired
    WXTopicService wxTopicService;

    @GetMapping("list")
    public BaseRespVo topicList(int page, int size) {
        TopicList topicList = wxTopicService.getTopicList(page, size);
        return BaseRespVo.ok(topicList);
    }

    @GetMapping("detail")
    public BaseRespVo wxTopicDetail(int id) {
        TopicDetail topicDetail = wxTopicService.getTopicDetail(id);
        return BaseRespVo.ok(topicDetail.getData());
    }

    @GetMapping("related")
    public BaseRespVo wxTopicRelated(int id) {
        TopicRelated topicRelated=wxTopicService.getTopicRelated(id);
        return BaseRespVo.ok(topicRelated.getData());
    }
}
